package tech.aistar.corejava.day12.homework.home05;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/7/30
 * @Version: 1.0
 */
public class Product implements Comparable<Product>{
    private Integer id;
    private String naem;
    private double price;
    private String address;

    public Product() {
    }

    public Product(Integer id, String naem, double price, String address) {
        this.id = id;
        this.naem = naem;
        this.price = price;
        this.address = address;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNaem() {
        return naem;
    }

    public void setNaem(String naem) {
        this.naem = naem;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Product{");
        sb.append("id=").append(id);
        sb.append(", naem='").append(naem).append('\'');
        sb.append(", price=").append(price);
        sb.append(", address='").append(address).append('\'');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Product product = (Product) o;

        if (id != null ? !id.equals(product.id) : product.id != null) return false;
        return naem != null ? naem.equals(product.naem) : product.naem == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (naem != null ? naem.hashCode() : 0);
        return result;
    }

    @Override
    public int compareTo(Product o) {
        return 0;
    }
}
